package com.zh.api.controller.common;

import com.alibaba.fastjson.JSONObject;
import com.zh.common.base.BaseController;
import com.zh.common.domain.DeptDO;
import com.zh.common.domain.Tree;
import com.zh.common.service.DeptService;
import com.zh.common.utils.ResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ProjectName: healthCare-parent
 * @Package: com.zh.api.controller.common
 * @ClassName: DeptController
 * @Description: java类作用描述
 * @Author: lds
 * @CreateDate: 2019/5/31 0031 11:55
 * @UpdateUser: 更新者
 * @UpdateDate: 2019/5/31 0031 11:55
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
@RestController
@RequestMapping("/dept")
@Api("部门相关")
public class DeptController extends BaseController{

    @Autowired
    private DeptService deptService;

    @RequestMapping(value = "getTreeByType", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    @ResponseBody
    @ApiOperation("获取不同系统的部门")
    public ResultVO getTreeByType(@RequestBody JSONObject jsonParam) {
        Integer type = jsonParam.getInteger("type");
        Tree<DeptDO> tree = new Tree<DeptDO>();
        tree = deptService.getTreeByType(type);
        return ResultVO.success(tree);
    }
}
